package middleware

import (
	"github.com/kataras/iris/context"

)

func After(ctx context.Context)  {
	ctx.Header("Access-Control-Allow-Origin", "*")
	ctx.Next()
}

func Before(ctx context.Context)  {
	if ctx.Method()=="OPTIONS" {
		ctx.Header("Access-Control-Allow-Origin", "*")
		ctx.Header("Access-Control-Allow-Headers", "Content-Type,uid,token")
		ctx.Header("Access-Control-Allow-Methods", "POST,GET")
		return
	}
	ctx.Header("Access-Control-Allow-Origin", "*")
	ctx.Next()
}
